package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.SchedulingOutSon;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SchedulingOutSonDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "外发主表id")
    private Integer schedulingOutId;

    @ApiModelProperty(value = "生产单id")
    private Integer produceId;

    @ApiModelProperty(value = "产品id")
    private Integer productId;

    @ApiModelProperty(value = "外发数量")
    private Integer schedulingNum;

    @ApiModelProperty(value = "生产状态:1生产中2生产完成")
    private Integer type;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "产品名称")
    private String productName;

    @ApiModelProperty(value = "生产单名称")
    private String produceName;

    @ApiModelProperty(value = "合同数量")
    private Integer contractNum;

    @ApiModelProperty(value = "单位名称")
    private String unitName;

    @ApiModelProperty(value = "产品备注")
    private String VproductRemark;

    @ApiModelProperty(value = "产品材质")
    private String VproductMaterial;


    public SchedulingOutSonDTO() {}

    public SchedulingOutSonDTO(SchedulingOutSon entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static SchedulingOutSonDTO convert(SchedulingOutSon entity) {
        return new SchedulingOutSonDTO(entity);
    }

    public static List<SchedulingOutSonDTO> convertList(List<SchedulingOutSon> list) {
        List<SchedulingOutSonDTO> resultList = new ArrayList<>();
        for (SchedulingOutSon entity : list) {
            resultList.add(new SchedulingOutSonDTO(entity));
        }
        return resultList;
    }}
